package com.sc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sc.mapper.StudyFileMapper;
import com.sc.mapper.StudyNoteMapper;
import com.sc.pojo.StudyFile;
import com.sc.pojo.StudyNote;
import com.sc.service.StudyFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudyFileServiceImpl implements StudyFileService {
  @Autowired
    StudyFileMapper sm;
  @Override
    public PageInfo<StudyFile> show(Integer pageNum,Integer pageSize){
      PageHelper.startPage(pageNum,pageSize);
      List<StudyFile> list=sm.show();
      return new PageInfo<>(list);
  }

  public PageInfo<StudyFile> showByfname(Integer pageNum,Integer pageSize,String fname){
    PageHelper.startPage(pageNum,pageSize);
    List<StudyFile> list=sm.showByfname(fname);
    return new PageInfo<>(list);
  }
  @Override
  public int deleteStudyFile(Integer fid) {
    int i=sm.deleteByPrimaryKey(fid);
    return i;
  }
  public int addFile(StudyFile file) {
     return sm.insert(file);
  }
}
